<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<%@include file="/common/head.jsp" %>

<c:set var="module" value="user"/>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form role="form" class="form-inline" id="query-form" method="post" action="${ctx }/admin/user/list" >
                        <!-- 查询开始 -->
                        <%--<input type="hidden" name="type" value="${type }" />
                        <input type="hidden" name="fromType" value="${fromType }" />
                        <div class="form-group">
                            <label for="query-user" class="sr-only">用户</label>
                            <input type="text" placeholder="用户名、昵称或手机" name="searchTerm" value="${query.searchTerm }" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <button class="btn btn-primary form-control" type="submit"><i class="fa fa-check"></i>&nbsp;查询</button>
                        </div>--%>
                        <!-- 查询结束 -->
                    </form>

                    <%--<div>
                        <p>
                            <sec:authorize access="hasRole('user.add')">
                                <button type="button" class="btn btn-outline btn-primary" onclick="add()">新增</button>
                            </sec:authorize>


                            <button type="button" class="btn btn-outline btn-info" onclick="edit()">详情</button>



                            &lt;%&ndash; <button type="button" class="btn btn-outline btn-danger" onclick="del();">删除</button>&ndash;%&gt;



                            <button type="button" class="btn btn-outline btn-primary" onclick="auth()">分配角色</button>



                            <button type="button" class="btn btn-outline btn-info" onclick="resetPwd()">重置密码</button>

                        </p>
                    </div>--%>
                    <table id="table" data-toggle="table" data-height="400" data-click-to-select="true" data-mobile-responsive="true">
                        <thead>
                        <tr>
                            <th data-field="state" data-checkbox="true"></th>
                            <th data-field="id">id</th>
                            <th data-field="type">类型</th>
                            <th data-field="username">用户名</th>
                            <th data-field="nickName">昵称</th>
                            <th data-field="email">邮箱</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${list }" var="n" varStatus="idx">
                            <tr data-index="${idx.index }">
                                <td class="bs-checkbox">
                                    <input data-index="0" name="btSelectItem" type="checkbox">
                                </td>
                                <td style="">${n.id }</td>
                                <td style="">${enum:list('UserType', n.type)}</td>
                                <td style="">${n.username }</td>
                                <td style="">${n.nickName }</td>
                                <td style="">${n.email }</td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>

                    <div class="row">
                        <div class="col-sm-6">
                            <div class="dataTables_info" id="DataTables_Table_0_info"
                                 role="alert" aria-live="polite" aria-relevant="all">显示第 ${(page.page - 1) * page.pageSize  + 1}
                                到第 ${(page.page) * page.pageSize} 项，共 ${page.totalRecords } 项</div>
                        </div>
                        <div class="col-sm-6">
                            <div class="dataTables_paginate paging_simple_numbers"
                                 id="DataTables_Table_0_paginate">
                                <ul class="pagination" id="pagination">
                                </ul>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<%@include file="/common/foot.jsp" %>
<script>

    var page = "${page.page}";
    function reload() {
        page_submit(page);
    }
    paging('pagination', ${page.totalPages}, ${page.page});


</script>
</body>
</html>